﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace OpenComposite.EII.Designer.Workflow.Forms
{
	public partial class FormSelectEventMethodAliasPath : Form
	{
		#region Initialization
		private FormSelectEventMethodAliasPath()
		{
			_path = null;
			_method = null;
			_event = null;

			InitializeComponent();

			this.DialogResult = DialogResult.Cancel;
		}
		public FormSelectEventMethodAliasPath(Repository.WorkflowMethod wfmethod)
			: this()
		{
			_method = wfmethod;
		}
		public FormSelectEventMethodAliasPath(Repository.WorkflowEvent wfevent)
			: this()
		{
			_event = wfevent;
		}
		#endregion

		#region Public Members

		#region Properties
		public string Path
		{
			get { return _path; }
		}
		#endregion

		#region Methods
		#endregion

		#endregion

		#region Private Members

		#region Fields
		private string _path;
		private Repository.WorkflowMethod _method;
		private Repository.WorkflowEvent _event;
		#endregion

		#region Methods
		private void fillTree()
		{
			if ( _method != null ) {
				fillTreeMethod();
			} else if ( _event != null ) {
				fillTreeEvent();
			} else {
				tvPath.Nodes.Clear();
			}
		}
		private void fillTreeMethod()
		{
			
		}
		private void fillTreeEvent()
		{
		}
		private void addBOFieldsToTreeNode(TreeNode tnParent, Repository.BusinessObjectField field)
		{
			if ( field.BusinessObjectID > 0 ) {
			} else {
			
			}
		}
		#endregion

		#region Event Handlers
		private void tsbtnOK_Click(object sender, EventArgs e)
		{
			this.DialogResult = DialogResult.OK;
			this.Close();
		}

		private void tsbtnCancel_Click(object sender, EventArgs e)
		{
			this.DialogResult = DialogResult.Cancel;
			this.Close();
		}

		private void tvPath_AfterSelect(object sender, TreeViewEventArgs e)
		{
			string[] path = e.Node.FullPath.Split(tvPath.PathSeparator[0]);
			_path = string.Join(".", path, 1, path.Length - 1);
		}
		#endregion

		#endregion
	}
}
